package primitiveTests;


import java.io.FileNotFoundException;
import java.io.IOException;
import static org.junit.Assert.assertFalse;
import gpinterpreter.vector.VecInterpreter;
import gpinterpreter.vector.VecInstruction;
import java.io.File;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

import java.util.List;

import org.junit.Before;
import org.junit.Test;

import primitives.cluster.ClusterHead;
import primitives.graph.Graph;
import primitives.graph.Node;

public class ClusterHeadTest {

	VecInterpreter interpreter;
	ClusterHead tree;
	Graph g;
	Node a,b,c,d,e,f;
	List<VecInstruction> program;
	@Before
	public void setUp() throws Exception {
		g = new Graph();
		a = new Node("a");
		b = new Node("b");
		c = new Node("c");
		d = new Node("d");
		e = new Node("e");
		f = new Node("f");
		
		g.addNode(a);
		g.addNode(b);
		g.addNode(c);
		g.addNode(d);
		g.addNode(e);
		g.addNode(f);
		tree = new ClusterHead(g);
	}
	
	@Test
	public void testClusterHead(){
		assertFalse(tree.getNodes().isEmpty());
		assertFalse(tree.getChildren().isEmpty());
		
			
	}

        @Test
        public void testSerialize() throws FileNotFoundException, IOException{
            FileOutputStream fos = new FileOutputStream(File.createTempFile("asdf", "sdfs"));
            ObjectOutputStream out = null;
            out = new ObjectOutputStream(fos);
            out.writeObject(tree);
            out.close();
        }

}
